import React, { Component } from "react";
import Unit from "../../unit";
import { withRouter } from "react-router-dom";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";

@withRouter
@inject("own")
@observer
class header extends Component {
  // https://home-api.pinduoduo.com/home/mediareports?page_number=1&page_size=20
  constructor() {
    super();
    this.state = {
      cfg: {
        page_number: 1,
        page_size: 20,
      },
    };
  }
  getData() {
    const { cfg } = this.state;
    const { getData } = this.props.own;
    Unit.getApi2("home/mediareports", cfg, {}).then((res) => {
      getData(res.data.data);
    });
  }
  componentDidMount() {
    this.getData();
  }
  render() {
    const { data } = this.props.own;
    const arr = toJS(data);
    console.log(arr);
    return <div className="own_header">header</div>;
  }
}

export default header;
